home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE02 / XTOOLS / XTOOL.ZIP / STPWATCH.INT < prev    next >
Encoding:
Text File  |  1995-05-28  |  2.4 KB  |  68 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       xTool - Component Collection                    }
  4. {                                                       }
  5. {       Copyright (c) 1995 Stefan B÷ther                }
  6. {                                                       }
  7. {*******************************************************}
  8. unit stpWatch;
  9.  
  10. interface
  11.  
  12. uses
  13.   WinTypes, WinProcs, SysUtils, Classes, Dialogs, Forms;
  14.  
  15. type
  16.   TResolution = (resMSeconds,resSeconds,resMinutes,resHours,resTime);
  17.  
  18.   TStopWatch = class(TComponent)
  19.   private
  20.     FBegin, FEnd: TDateTime;
  21.     FStart      : Boolean;
  22.     FPause      : Boolean;
  23.     FDisplay    : Boolean;
  24.     FDisplayText: PString;
  25.     FResolution : TResolution;
  26.     FOnStop     : TNotifyEvent;
  27.     FOnStart    : TNotifyEvent;
  28.     FOnDisplay  : TNotifyEvent;
  29.     function    GetDisplayText: String;
  30.     function    GetMSeconds: Longint;
  31.     function    GetSeconds: Longint;
  32.     function    GetMinutes: Longint;
  33.     function    GetHours: Longint;
  34.     function    GetTime: TDateTime;
  35.     function    GetBegin: TDateTime;
  36.     function    GetEnd: TDateTime;
  37.     function    GetString: String;
  38.     procedure   SetDisplayText(Value: String);
  39.     procedure   SetStart(Value: Boolean);
  40.     procedure   SetPause(Value: Boolean);
  41.   public
  42.     constructor Create(aOwner:TComponent); override;
  43.     destructor  Destroy; override;
  44.     procedure   Start;
  45.     procedure   Stop;
  46.     procedure   Pause;
  47.     procedure   Resume;
  48.     procedure   Show;
  49.     property    MSeconds: Longint read GetMSeconds;
  50.     property    Seconds: Longint read GetSeconds;
  51.     property    Minutes: Longint read GetMinutes;
  52.     property    Hours: Longint read GetHours;
  53.     property    Time: TDateTime read GetTime;
  54.     property    AsString: String read GetString;
  55.     property    Paused: Boolean read FPause write  SetPause;
  56.     property    Started: Boolean read FStart write SetStart;
  57.   published
  58.     property    Display: Boolean read FDisplay write FDisplay;
  59.     property    DisplayText: String read GetDisplayText write SetDisplayText;
  60.     property    Resolution: TResolution read FResolution write FResolution;
  61.     property    OnStart: TNotifyEvent read FOnStart write FOnStart;
  62.     property    OnStop: TNotifyEvent read FOnStop write FOnStop;
  63.     property    OnDisplay: TNotifyEvent read FOnDisplay write FOnDisplay;
  64.   end;
  65.  
  66.   procedure Register;
  67.  
  68.